<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Test Ajax Content</title>
  <script src="../../../lib/prototype.js" type="text/javascript"></script>
  <script src="../../../lib/effects.js" type="text/javascript"></script>
  <script src="../../../dist/window.js" type="text/javascript"></script>

  <link href="../../../themes/window/window.css" rel="stylesheet" type="text/css">
  <link href="../../../themes/window/alphacube.css" rel="stylesheet" type="text/css">

  <style type='text/css'>
  body {
    background: #E6E6E6;
  }
    
  .message {
    font-family: Georgia;
    text-align: center;
    margin-top: 20px;
  }
  
  .spinner {
    background: url(../../assets/images/spinner.gif) no-repeat center center;
    height: 40px;
  }
  </style>
</head>
<body>

<script type="text/javascript">

function runTest() {
  // Request will take 2 seconds to complete
  Ajax.Request.prototype.originalInitialize = Ajax.Request.prototype.initialize;
  Ajax.Request.prototype.initialize = function(url, options) {
      options.onComplete = options.onComplete.wrap(function(proceed, req) {
        proceed.curry(req).delay(2);
      });
      this.originalInitialize(url, options);
  }

  new UI.Window().show().setAjaxContent('../../fixtures/ajax_content.html', {
    method: "GET", 
    onCreate: function() {   
      this.setContent('<div class="message">Please wait...</div><div class="spinner"></div>');   
    }
  });                 
}

Event.observe(window, "load", runTest);

</script>

</body>
</html>
